package laschools.team1.Zelda;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class HUDPanel extends JPanel{
	private Image hud;
	private Dimension dimension;

	public HUDPanel() {
		dimension = new Dimension(800, 200);
		setPreferredSize(dimension);
		hud = new ImageIcon(this.getClass().getResource("../../../Sprites/Zelda Hud.png")).getImage();
	}
	
	public void paint(Graphics g) {
		int squareLength = FrameMain.getSquareLength();
		int HUDheight = FrameMain.getHUDheight();
		int xScreen = FrameMain.getScreenPosition().x;
		int yScreen = FrameMain.getScreenPosition().y;
		
		super.paintComponents(g);
		//Draw the background
		dimension.setSize(FrameMain.getSquareLength() * 16,FrameMain.getHUDheight());
		setPreferredSize(dimension);
		g.drawImage(hud, 0, 0, FrameMain.getSquareLength() * 16, FrameMain.getHUDheight(), this);
		
		//Draw the minimap dot
		g.setColor(Color.green);
		g.fillRect(squareLength + (xScreen * (squareLength / 4)),
				(HUDheight - (squareLength / 2)) - (yScreen * (squareLength / 4)),
				(squareLength / 4), (squareLength / 4));
	}

	
}
